import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
// import { ChooseUsedScenePage} from "../choose-used-scene/choose-used-scene";
// import {ChooseUsedDevicePage} from "../choose-used-device/choose-used-device";
// import {MessagePage} from "../message/message";
import {TimingPage} from "../timing/timing";
import {PublicProvider} from "../../providers/public/public";

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
    is_scene_open = [false, false, false, false, false, false, false, false];
    is_device_open = [false, false, false, false, false, false, false, false];
    devices:any;
    scenes:any;
    used_device:any;
    used_scene:any;

    constructor(public navCtrl: NavController,private pub:PublicProvider) {

    }

    ionViewDidLoad() {
      this.devices = this.pub.device_list;
      this.scenes = this.pub.scene_list;
      this.used_device = this.devices.slice(0,8);
      this.used_scene = this.scenes.slice(0,8);
      // console.log(this.used_device);
    }

    goto_timing(){
      this.navCtrl.push(TimingPage);
    }


    scene_switch(n){
      this.is_scene_open[n] = !this.is_scene_open[n];
    }

    scene_device(n){
      this.is_device_open[n] = !this.is_device_open[n];
    }

}
